﻿#ifndef COMMANDITEM_H
#define COMMANDITEM_H

#include <QObject>
#include <QVector>
#include "scriptitem.h"
class TaskItem;
/**
 * @brief The CommandItem class 指令类，隶属于任务
 */
class CommandItem : public QObject
{
    Q_OBJECT
public:

    enum CmdWorkMode
    {
        Mode_FastPoint,
        Mode_SlideScan,
        Mode_StepScan
    };
    struct FastTargetPos{
        QString  miTargetPosWorkMode;
        double mdTargetPosDuration;
    };
    void setFastPosMode(FastTargetPos fastpos);
    FastTargetPos getFastPosMode();

    explicit CommandItem(const QString& sName,QObject *parent = 0);

    QString getName();

    //QString getTaskName();

    void setValue(ScriptItem::PosType type,double value);
    double getValue(ScriptItem::PosType type);


    void setWorkMode(CmdWorkMode value);
    CmdWorkMode getWorkMode();

    ScriptItem* addScript(const QString& name);
    void removeScript(const QString& objName);
    QVector<ScriptItem*> allScripts();
    ScriptItem* getScript(const QString& objName);

    void setTargetPos();
    TaskItem *task;
signals:

public slots:

private:
    QString msName;

    double mdStartTime;
    double mdEndTime;
    QString msCommandCode;// 指令内码

    double mdEWStart;
    double mdNSStart;
    double mdEWEnd;
    double mdNSEnd;

    //理论开始位置结束位置
    double mdrealewstart;
    double mdrealewend;

    CmdWorkMode mnWorkMode;//0:快速指向,1:扫描成像，2步进成像

    FastTargetPos  fastmode;

    QVector<ScriptItem *> mvctScripts;

};

#endif // COMMANDITEM_H
